package pe.gob.sunarp.entidad;

import java.io.Serializable;
import javax.persistence.*;

/**
 * The primary key class for the USR_CONVENIO_PERMISO database table.
 * 
 */
@Embeddable
public class UsrConvenioPermisoPK implements Serializable {
	//default serial version id, required for serializable classes.
	private static final long serialVersionUID = 1L;
	private long codConvenio;
	private String usrId;
	private long codGrupoLibroArea;

    public UsrConvenioPermisoPK() {
    }

	@Column(name="COD_CONVENIO", unique=true, nullable=false)
	public long getCodConvenio() {
		return this.codConvenio;
	}
	public void setCodConvenio(long codConvenio) {
		this.codConvenio = codConvenio;
	}

	@Column(name="USR_ID", unique=true, nullable=false, length=15)
	public String getUsrId() {
		return this.usrId;
	}
	public void setUsrId(String usrId) {
		this.usrId = usrId;
	}

	@Column(name="COD_GRUPO_LIBRO_AREA", unique=true, nullable=false)
	public long getCodGrupoLibroArea() {
		return this.codGrupoLibroArea;
	}
	public void setCodGrupoLibroArea(long codGrupoLibroArea) {
		this.codGrupoLibroArea = codGrupoLibroArea;
	}

	public boolean equals(Object other) {
		if (this == other) {
			return true;
		}
		if (!(other instanceof UsrConvenioPermisoPK)) {
			return false;
		}
		UsrConvenioPermisoPK castOther = (UsrConvenioPermisoPK)other;
		return 
			(this.codConvenio == castOther.codConvenio)
			&& this.usrId.equals(castOther.usrId)
			&& (this.codGrupoLibroArea == castOther.codGrupoLibroArea);

    }
    
	public int hashCode() {
		final int prime = 31;
		int hash = 17;
		hash = hash * prime + ((int) (this.codConvenio ^ (this.codConvenio >>> 32)));
		hash = hash * prime + this.usrId.hashCode();
		hash = hash * prime + ((int) (this.codGrupoLibroArea ^ (this.codGrupoLibroArea >>> 32)));
		
		return hash;
    }
}